import React, { PureComponent, Fragment } from "react";
import { Button, Menu, Icon, message, Modal, Carousel, Radio, Form, Card, Input, Switch, Checkbox, Row, Col, Divider } from "antd";
import styles from "./VideoPlayer.less";
class VideoPlayer extends PureComponent {
  constructor(props) {
    super(props);
    this.videoWin = React.createRef();
  }
  componentDidMount() {
    const { onLoaded } = this.props;
    const $video = this.videoWin.current;
    $video.addEventListener("canplaythrough", () => {
      onLoaded();
    });
  }
  render() {
    const { src, autoPlay } = this.props;
    return (
      <div className={styles.videoBox}>
        <video ref={this.videoWin} autoPlay={autoPlay} src={src} controls="controls"></video>
      </div>
    );
  }
}
export default VideoPlayer;
